package com.hua.nailcampus.acl.controller;


import com.hua.nailcampus.acl.service.FileUploadService;
import com.hua.nailcampus.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;

/**
 * @Author:chenjianhua
 * @Date:2023/6/16 16:48
 * @Version 1.8
 */
@RestController
@RequestMapping("/nailCampus")
@Slf4j
public class FileUploadController {

    @Autowired
    private FileUploadService fileUploadService;

    /**
     * 图片上传
     * @param file
     * @return
     */
    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file){
        String url = fileUploadService.uploadFile(file);
        return Result.ok(url);
    }


}
